package com.dev.mybatisplus.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author mini
 */
@Configuration
@EnableSwagger2
public class Knife4Config {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                //是否开启，根据环境配置
                .apiInfo(new ApiInfoBuilder()
                        .title("后端接口")
                        .description("springboot-mybatisPlus3.5接口文档")
                        .contact(new Contact("niu hao","localhost","xxx"))
                        .version("1.0")
                        .build()
                )
                .host("127.0.0.1")
                .groupName("mybatisplus3.5")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.dev.mybatisplus"))
                .paths(PathSelectors.any())
                .build();
    }
}
